﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<div class="content-box">
    <a name="honnhan"></a>
    <div class="content-box-header">
        <h3>
            Hôn Nhân</h3>
    </div>
    <!-- End .content-box-header -->
    <div class="content-box-content">
        <%Html.RenderAction("ViewUserControlHonNhan", new { giaodanModel = Model });%>
    </div>
    <!-- End .content-box-content -->
</div>
<script language="javascript" type="text/javascript">
    function TimNhanChung1() {
        Dialog('<%=Url.Action("TimPhuThan2","GiaDinhCongGiao") %>', '', 'Nhân Chứng 1', 1000, 335, HideDialog, ClearDataNhanChung);
    }
    function TimNhanChung2() {
        Dialog('<%=Url.Action("TimPhuThan2","GiaDinhCongGiao",new {id=1}) %>', '1', 'Nhân Chứng 2', 1000, 335, HideDialog, ClearDataNhanChung);
    }
    function ReceiveNhanChung(type, id, value) {
        if (type) {
            $('.honnhan #TENNHANCHUNG2').val(value);
            $('.honnhan #MANHANCHUNG2').val(id);
        }
        else {
            $('.honnhan #TENNHANCHUNG1').val(value);
            $('.honnhan #MANHANCHUNG1').val(id);
        }
    }
    function ClearDataNhanChung(type) {
        if (type) {
            $('.honnhan #TENNHANCHUNG2').val('');
            $('.honnhan #MANHANCHUNG2').val('');
        }
        else {
            $('.honnhan #TENNHANCHUNG1').val('');
            $('.honnhan #MANHANCHUNG1').val('');
        }
    }
    function TimLinhMuc1() {
        Dialog('<%=Url.Action("TimLinhMuc1","GiaDinhCongGiao",new {id=ViewData["GENDERID"]}) %>', '', 'Tìm Linh Mục', 665, 300, HideDialog, ClearDataLinhMuc1);
    }
    function ReceiveLinhMuc1(id, value) {
        $('.honnhan #TENLINHMUC').val(value);
        $('.honnhan #MALINHMUC').val(id);
    }
    function ClearDataLinhMuc1() {
        $('.honnhan #TENLINHMUC').val('');
        $('.honnhan #MALINHMUC').val('');
    }
    function ClearChaMe() {
        $('.honnhan #TENCHA').val('');
        $('.honnhan #TENME').val('');
    }
    function GetChaMe(id) {
        $.post('<%=Url.Action("GetTenChaMe", "GiaDinhCongGiao") %>', { id: id },
            function (data) {
                $('.honnhan #TENCHA').val(data.cha);
                $('.honnhan #TENME').val(data.me);
            });
    }
    function Initial() {
        $(".honnhan #MAGIAOPHAN").change(function () {
            Change_GiaoPhan('honnhan', '<%=Url.Action("Get_GIAOHAT","GiaDinhCongGiao",new {area="AdminCP"}) %>', this.value);
        });
        $(".honnhan #MAGIAOHAT").change(function () {
            Change_GiaoHat('honnhan', '<%=Url.Action("Get_GIAOXU","GiaDinhCongGiao",new {area="AdminCP"}) %>', this.value);
        });
    }
</script>
